package leetcode;

public class Lc191 {

    public static int hammingWeight(int n) {
        int ans = 0;
        while (n != 0) {
            ans += (n & 1);
            n >>= 1;
        }
        return ans;
    }


    public static void main(String[] args) {
        System.out.println(hammingWeight(128));
    }

}
